<!DOCTYPE html>
<html>
<head>
    <title>JSON Parse Example</title>
</head>
<body>
    <p>This example parses a string containing a date into an object.</p>
    <script type="text/javascript">
        var book = {
                       "title": "Professional JavaScript",
                        "authors": [
                            "Nicholas C. Zakas"
                        ],
                        edition: 3,
                        year: 2011,
                        releaseDate: new Date(2011, 11, 1)
                   };

        var jsonText = JSON.stringify(book);
        alert(jsonText);
        
        var bookCopy = JSON.parse(jsonText, function(key, value){
            if (key == "releaseDate"){
                return new Date(value);
            } else {
                return value;
            }
        });
        
        alert(bookCopy.releaseDate.toISOString());

    </script>
</body>
</html>
